<div ng-controller="DeviceCtrl">

  <div ng-if="!device.isConnected()" class="alert alert-warning" translate="device.load.connect-device-message">
    <strong>Please connect your device</strong> to access this section.
  </div>

  <div class="alert alert-warning alert-withicon alert-lg">
    <span class="glyphicon glyphicon-warning-sign alert-icon"></span>
    <p translate="device.load.caution-title">This is an advanced interface intended for EXPERT use only!</p>
    <p translate="device.load.caution-content-1" translate-values="{ deviceId: device.id }">If you are a common user and want to setup or recover your BWallet device,
       please continue to <a href="#/device/{{device.id}}">BWallet Setup</a>.</p>
    <p translate="device.load.caution-content-2">Never use this process unless you REALLY know what you are doing!</p>
    <p translate="device.load.caution-content-3">No checks are performed on the provided seed, so it can be binary sequence, dice-throw sequence
       or a random sentence. Valid BIP32 XPRV keys are interpreted prior loading to the device.</p>
  </div>

  <div ng-controller="DeviceLoadCtrl"
       class="row">

    <fieldset ng-disabled="!device.isConnected()">
      <form name="form" class="devload col-md-6">

        <div class="form-group">
          <label for="label" class="control-label" translate="device.load.device-label">Device label</label>
          <input type="text" name="label" id="label" class="form-control"
                 placeholder="My BWallet"
                 ng-model="settings.label">
        </div>
        
        <div class="form-group">
          <label for="language" class="control-label" translate="device.load.device-language">Device language</label>
          <select name="language" id="language" class="form-control"
                 ng-model="settings.language"
                 ng-options="language.code as language.label for language in languages">
          </select>
        </div>

        <div class="form-group">
          <label for="payload" class="control-label" translate="device.load.seed-or-xprv">Recovery seed or XPRV private key</label>
          <textarea name="payload" id="payload" class="form-control" required
                    ng-model="settings.payload"></textarea>
        </div>

        <div class="checkbox">
          <label>
            <input type="checkbox" name="skip-checksum"
                   ng-model="settings.skip_checksum"> Skip mnemonic checksum
          </label>
        </div>

        <div class="form-group">
          <label for="pin" class="control-label">PIN</label>&nbsp;{{ 'device.load.pin-message' | translate }}
          <input type="text" name="pin" id="pin" class="form-control"
                 ng-model="settings.pin">
        </div>

        <div class="checkbox">
          <label>
            <input type="checkbox" name="passphrase-protection"
                   ng-model="settings.passphrase_protection"> {{ 'device.load.passphrase' | translate }}
          </label>
        </div>

        <div class="form-group">
          <button class="btn btn-primary"
                  ng-disabled="!form.$valid"
                  ng-click="loadDevice()" translate="device.load.continue">Continue</button>
          <a href="#/device/{{device.id}}"
             class="btn btn-link" translate="device.load.cancel">Cancel</a>
        </div>

      </form>
    </fieldset>

  </div>

</div>
